<style>
    .days{
        display: none;
    }
    .n5w{
        display: none;
    }
</style>
<form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Category_id')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-category_id" data-rule="required" onchange="news()"  data-source="category/selectpage" class="form-control selectpage" name="row[category_id]" type="text" value="">
        </div>
    </div>
    <div class="form-group days">
        <label class="control-label col-xs-12 col-sm-2">{:__('科室选择')}:</label>
        <div class="col-xs-12 col-sm-8">
            <select  id="c-ks_text" class="form-control selectpicker" name="row[ks_text]">
                <option value="0" >请选择</option>
                <option value="办公室" >办公室</option>
                <option value="政治工作科" >政治工作科</option>
                <option value="教务科" >教务科</option>
                <option value="教学训练科" >教学训练科</option>
                <option value="后勤科" >后勤科</option>
                <option value="学员管理科" >学员管理科</option>
            </select>
        </div>
    </div>
    <div class="form-group newdays n2 n1 n3 n4">
        <label class="control-label col-xs-12 col-sm-2">{:__('Title')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-title"  class="form-control" name="row[title]" type="text">
        </div>
    </div>
    <div class="form-group newdays n2 n1 n3 n4">
        <label class="control-label col-xs-12 col-sm-2">{:__('作者')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-author"  class="form-control" name="row[author]" type="text">
        </div>
    </div>
    <div class="form-group n1">
        <label class="control-label col-xs-12 col-sm-2">{:__('Url')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-url" class="form-control" name="row[url]" type="text">
        </div>
    </div>
        <div class="form-group n2 n3">
            <label for="c-image" class="control-label col-xs-12 col-sm-2">{:__('列表图片')}:</label>
            <div class="col-xs-12 col-sm-8">
                <div class="input-group">
                    <input id="c-image" class="form-control" size="35" name="row[list_image]" type="text" value="">
                    <div class="input-group-addon no-border no-padding">
                        <span><button type="button" id="faupload-image" class="btn btn-danger faupload" data-input-id="c-image" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp" data-multiple="false" data-preview-id="p-image"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
                        <span><button type="button" id="fachoose-image" class="btn btn-primary fachoose" data-input-id="c-image" data-mimetype="image/*" data-multiple="false"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
                    </div>
                    <span class="msg-box n-right"></span>
                </div>
                <ul class="row list-inline faupload-preview" id="p-image"></ul>
            </div>
        </div>
    <div class="form-group n5w">
        <label class="control-label col-xs-12 col-sm-2">{:__('Desc')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-desc"  class="form-control" name="row[desc]" type="text">
        </div>
    </div>
    <div class="form-group n2">
        <label class="control-label col-xs-12 col-sm-2">{:__('Content')}:</label>
        <div class="col-xs-12 col-sm-8">
            <textarea id="c-content" class="form-control editor" rows="5" name="row[content]" cols="50"></textarea>
        </div>
    </div>
    <div class="form-group" style="display:none;">
        <label class="control-label col-xs-12 col-sm-2">{:__('Images')}:</label>
        <div class="col-xs-12 col-sm-8">
            <div class="input-group">
                <input id="c-images" class="form-control" size="50" name="row[images]" type="textarea">
                <div class="input-group-addon no-border no-padding">
                    <span><button type="button" id="faupload-images" class="btn btn-danger faupload" data-input-id="c-images" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp,image/webp" data-multiple="true" data-preview-id="p-images"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
                    <span><button type="button" id="fachoose-images" class="btn btn-primary fachoose" data-input-id="c-images" data-mimetype="image/*" data-multiple="true"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
                </div>
                <span class="msg-box n-right" for="c-images"></span>
            </div>
            <ul class="row list-inline faupload-preview" id="p-images"></ul>
        </div>
    </div>

    <!--<div class="form-group">-->
    <!--    <label class="control-label col-xs-12 col-sm-2">{:__('导航')}:</label>-->
    <!--    <div class="col-xs-12 col-sm-8">-->
    <!--        <input id="c-category_id"  data-source="nav/index" class="form-control selectpage" name="row[nav_id]" type="text" value="">-->
    <!--    </div>-->
    <!--</div>-->
    <div class="form-group n4">
        <label class="control-label col-xs-12 col-sm-2">{:__('File')}:</label>
        <div class="col-xs-12 col-sm-8">
            <div class="input-group">
                <input id="c-file"  class="form-control" size="50" name="row[file]" type="text">
                <div class="input-group-addon no-border no-padding">
                    <span><button type="button" id="faupload-file" class="btn btn-danger faupload" data-input-id="c-file" data-multiple="false" data-preview-id="p-file"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
                    <span><button type="button" id="fachoose-file" class="btn btn-primary fachoose" data-input-id="c-file" data-multiple="false"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
                </div>
                <span class="msg-box n-right" for="c-file"></span>
            </div>
            <ul class="row list-inline faupload-preview" id="p-file"></ul>
        </div>
    </div>

    <div class="form-group layer-footer">
        <label class="control-label col-xs-12 col-sm-2"></label>
        <div class="col-xs-12 col-sm-8">
            <button type="submit" class="btn btn-primary btn-embossed disabled">{:__('OK')}</button>
            <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
        </div>
    </div>
</form>
<script src="/assets/libs/jquery/dist/jquery.min.js"></script>
<script>
/*    $(document).on("change", "#c-category_id", function(res){
        //后续操作
        console.log(res,33)
    });*/
    function news(){

        console.log($('#c-category_id').val());
        $.ajax({
            type: 'POST',
            url: "{:url('article/news')}",
            data: {
                'id': $('#c-category_id').val(),
            },
            success:function (datas) {
                if (datas.code==1){
                    if (datas.data.type=="default"){
                        $('.n2').css('display','none');
                        $('.n3').css('display','none');
                        $('.n4').css('display','none');
                        $('.n5').css('display','none');
                        $('.n1').css('display','block');
                    }
                    if (datas.data.type=="article"){
                        $('.n1').css('display','none');
                        $('.n3').css('display','none');
                        $('.n4').css('display','none');
                        $('.n5').css('display','none');
                        $('.n2').css('display','block');
                    }
                    if (datas.data.type=="test"){
                        $('.n1').css('display','none');
                        $('.n2').css('display','none');
                        $('.n4').css('display','none');
                        $('.n5').css('display','none');
                        $('.n3').css('display','block');
                    }
                    if (datas.data.type=="news"){
                        $('.n1').css('display','none');
                        $('.n2').css('display','none');
                        $('.n3').css('display','none');
                        $('.n5').css('display','none');
                        $('.n4').css('display','block');
                    }
                    if (datas.data.type=="mydetail"){
                        $('.n1').css('display','none');
                        $('.n2').css('display','none');
                        $('.n3').css('display','none');
                        $('.n4').css('display','none');
                        $('.n5').css('display','block');
                    }
                }else{
                    layer.msg(datas.msg);
                }
            },
            error: function (jqXHR, textStatus, errorThrown) {
                /*错误信息处理*/
                layer.msg(textStatus);
            }
        });
        if($('#c-category_id').val() == 18){
//            console.log($('.days').val());die;
            $('.n5w').css('display','block');
        }else{
            $('.n5w').css('display','none');
        }
        if($('#c-category_id').val() == 26){
//            console.log($('.days').val());die;
            $('.days').css('display','block');
            $('.newdays').css('display','block');
        }else{
            console.log(22);
            $('.days').css('display','none');
            $('.newdays').css('display','block');
        }
    }
</script>